package component.show.containers
{
	import common.manager.Resource;
	
	import component.show.control.UISprite;
	
	import flash.display.DisplayObject;
	import flash.display.SimpleButton;
	
	public class SimpleBtn extends UISprite
	{
		private var m_simpleBtn : SimpleButton; 
		
		private var m_skinName : String;
		
		public function SimpleBtn(upState:DisplayObject=null, overState:DisplayObject=null, downState:DisplayObject=null, hitTestState:DisplayObject=null)
		{
			this.width = 10;
			this.height = 10;
			
			m_simpleBtn = new SimpleButton;
			
			m_simpleBtn.upState = upState;
			m_simpleBtn.downState = downState;
			m_simpleBtn.overState = overState;
			m_simpleBtn.hitTestState = hitTestState;
			
			this.addChild(m_simpleBtn);
		}
		
		public override function destory() : void
		{
			m_simpleBtn = null;
		}
		
		public function set skinName(name : String) : void
		{
			m_skinName = name;
			
			var clas : Class = Resource.getClass(name,"UISkin");
			
			renderer = clas;
		}
		
		public function get skinName() : String
		{
			return m_skinName;
		}
		
		public function set renderer(renderClass : Class) : void
		{
			var sbtn : SimpleButton = new renderClass	as SimpleButton;
			
			m_simpleBtn.upState = sbtn.upState;
			m_simpleBtn.overState = sbtn.overState;
			m_simpleBtn.downState = sbtn.downState;
			m_simpleBtn.hitTestState = sbtn.hitTestState;
			
			this.width = sbtn.width;
			this.height = sbtn.height;
		}
	}
}